package com.goldenautumn.prefabricate.activity.mall

import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.webkit.WebView
import com.blankj.utilcode.util.SnackbarUtils.getView

class GoodsDetailsWebView : WebView {

    constructor(context: Context) : super(context) {}

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}

    override fun scrollBy(x: Int, y: Int) {
        super.scrollBy(x, y)
        // 把滑动交给它的子view
        if(x != null && y != null) getView()?.scrollBy(x, y)
    }

    @SuppressLint("Range")
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val height = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 0, MeasureSpec.AT_MOST)
        super.onMeasure(widthMeasureSpec, height)
    }

}